/*
 * p11825.cpp
 *
 *  Created on: 2013-10-3
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int n, m, x, cas = 0;
int p[17], cover[70000], f[70000];
int main()
{
	while (scanf("%d", &n) && n != 0)
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &m);
			p[i] = 1 << i;
			while (m--)
			{
				scanf("%d", &x);
				p[i] |= (1 << x);
			}
		}
		for (int S = 0; S < (1 << n); S++)
		{
			cover[S] = 0;
			for (int i = 0; i < n; i++)
				if (S & (1 << i))
					cover[S] |= p[i];
		}
		f[0] = 0;
		int ALL = (1 << n) - 1;
		for (int S = 1; S < (1 << n); S++)
		{
			f[S] = 0;
			for (int S0 = S; S0; S0 = (S0 - 1) & S)
				if (cover[S0] == ALL)
					f[S] = max(f[S], f[S ^ S0] + 1);
		}
		printf("Case %d: %d\n", ++cas, f[ALL]);

	}
	return 0;
}
